#ifndef DATABASE_MANAGER_H
#define DATABASE_MANAGER_H

#include <QObject>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QVariant>
#include <QHash>
#include <QMessageBox>
#include <QtDebug>

class Database_manager : public QObject
{
    Q_OBJECT
private:
    QSqlDatabase db;
    bool connection();
    void disconnection();

public:
    explicit Database_manager(QString sql_type, QString host, int port, QString user, QString password, QString db_name, QObject *parent = 0);
    ~Database_manager();
    bool insert(QString table);
    bool update(QString table);
    bool remove(QString table);
    int select(QString & out, QString table, bool sort = false, QString sort_column = "", QString sort_type = "");
    bool request(QString q, QList< QHash<QString, QString> > * list_result = NULL);
    bool test_connection(QString & out);

signals:

public slots:

};

#endif // DATABASE_MANAGER_H
